void Swap(int* x, int* y)
{
    int temp = *x;
    *x = *y;
    *y = temp;
}

void Mergesort(int* a, int* c, int left, int right)
{
    if (left >= right)
    {
        return;
    }
    int mid = (left + right) / 2;
    Mergesort(a, c, left, mid);
    Mergesort(a, c, mid + 1, right);
    int begin1 = left, end1 = mid;
    int begin2 = mid + 1, end2 = right;
    int i = left, n = begin1;
    while (begin1 <= end1 && begin2 <= end2)
    {
        if (a[begin1] < a[begin2])
        {
            Swap(&c[i++], &a[begin1++]);
        }
        else
        {
            Swap(&c[i++], &a[begin2++]);
        }
    }
    while (begin1 <= end1)
    {
        c[i++] = a[begin1];
        begin1++;
    }
    while (begin2 <= end2)
    {
        c[i++] = a[begin2];
        begin2++;
    }
    for (int j = n; j <= end2; j++)
    {
        a[j] = c[j];
    }
}

bool containsDuplicate(int* nums, int numsSize) {
    int* c = (int*)malloc(sizeof(int) * numsSize);
    Mergesort(nums, c, 0, numsSize - 1);
    for (int i = 1; i < numsSize; i++)
    {
        if (nums[i] == nums[i - 1])
        {
            return true;
        }
    }

    return false;

}